package com.nbsaas.boot.storage.rest.convert;

import com.nbsaas.boot.storage.data.entity.File;
import com.nbsaas.boot.storage.api.domain.request.FileRequest;

import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;

/**
* 请求对象转换成实体对象
*/

public class FileEntityConvert  implements Converter<File, FileRequest> {

    @Override
    public File convert(FileRequest source) {
        File result = new File();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getParent()!=null){
                    File parent =new File();
                    parent.setId(source.getParent());
                    result.setParent(parent);
                    }
        return result;
    }
}

